package homework0707;

import jk.ToolService;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * 时间类
 */
public class TimeObj implements ToolService {
    //编写一个函数，实现日期格式化处理
    @Override
    public String timeUtil(DateElement dateelement) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
        LocalDate nowDate = null;
        String format = "";
        if (dateelement.getYear() == 0 && dateelement.getMonth() == 0 && dateelement.getDay() == 0) {
            nowDate = LocalDate.now();
            format = nowDate.format(formatter);
            return format;
        }
        nowDate = LocalDate.of(dateelement.getYear(), dateelement.getMonth(), dateelement.getDay());
        format = nowDate.format(formatter);
        return format;
    }

    @Override
    public String transformUtil(StringElement stringElement) {
        return null;
    }

    @Override
    public String transformUtil1(double number) {
        return null;
    }


}
